Skip to content

Latest commit

 

History

History
68 lines (50 loc) · 1.9 KB

2023-07-04-implementing-the-slack-meme-bot copy.md

File metadata and controls

68 lines (50 loc) · 1.9 KB
layout author title subTitle date categories tags bigimg img desc series toc
post
Van Schandevijl Wouter
The itenium Slack Meme Bot® : Implementation
How was the Slack Meme Bot implemented?
2023-07-04
javascript
product
fun
url desc origin prompt
slack-meme-bot-big.png
By Midjourney
Midjourney
memes on social media --ar 2:1
url desc origin title prompt
slack-meme-bot2.png
Actual footage of our meme bot!
Midjourney
By Midjourney
the slack meme bot
Technical implementation details for the Slack Meme Bot
slack-meme-poster
icon title
slack
Slack Meme Bot

How does the Slack Meme Bot work, technically?

docker-compose

The docker-compose exists of two services

File Server

halverneus/static-file-server makes the memes accessible from the internet.
The Slack WebHook sends just the url of the meme, after which Slack attempts to download the image before actually posting it.

If Slack cannot download the image, nothing will show up in your Slack channel.

You will probably need to configure the meme file accessibility.

chmod -R 755 memes_dir

Cron Job

The Dockerfile copies the job folder with the Node program to the docker container and then runs start.sh which schedules running slack-meme-poster.js and starts the Cron daemon.

Slack Meme Poster

The slack-meme-poster.js selects a random file from your MEMES_DIR and moves it to a already-sent subfolder to make sure no meme is ever posted twice.

It then sends the meme url to Slack using the WebHook and 🎉, meme posted!

Make it your own

Configure the actual Slack message

  • messageToPostWithMeme: A simple string sent along with the meme
  • Configure the entire Slack message using the Slack Block Kit Builder